// 方式一
//
// 时间：896ms - 5%
var singleNumber = function(nums) {
  for (let index = 0; index < nums.length; index++) {
    const element = nums[index];
    if (nums.lastIndexOf(element) === nums.indexOf(element)) {
      return element;
    }
  }
};

console.log(singleNumber([1, 3, 2, 1, 2]));
